<?php	
				global $wpdb;				
				$date = date('Y-m-d H:s:i');
				$customer = array(
 							'customerName'			=> $_POST['Name'],
 							'customerEmail'			=> $_POST['Email'],
 							'customerAddress'		=> $_POST['Address'],
 							'customerPhone'			=> $_POST['Phone'], 							
 							'customerComment'		=> $_POST['Message'],
							'guestParent'			=> 0,
 							'date'					=> $date	
 							);
				// Insert customer
 				$customerID = db_insert_data("customers",$customer,$date);			
 				$company = array(
 							'companyName'			=> $_POST['company_name'],
 							'companyEmail'			=> $_POST['company_email'],
 							'companyAddress'		=> $_POST['company_address'],
 							'companyPhone'			=> $_POST['company_phone'],
 							'companyFax'			=> $_POST['company_fax'],
 							'companyComment'		=> $_POST['company_message'],
 							'customerID'			=> $customerID,
 							'date'					=> $date	
 							);	
 							
 				//Insert company agent.
 				$companyID = db_insert_data("agents", $company, $date);
 				if($companyID)
 				{
 					$email_support = "email_support_travel_agent";
 					include TEMPLATEPATH.'/views/book/view-hotel-tour-thanks.php';
 					include TEMPLATEPATH.'/mails/xtemplate-email-travel-agent.php';
 					
 				}
 				else 
 				{
 					echo 'Sorry, Register travel agents failed.Please try again.';
 				}
			$_SESSION['ma_xac_nhan'] = null;

			?>